package com.yinuo.repository;

import com.yinuo.entity.DocBinary;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * linux文档仓库类
 */
public interface DocRepository extends JpaRepository<DocBinary,String>{

    //复杂查询
    Page<DocBinary> findAll(Specification<DocBinary> spec, Pageable pageable);

    @Modifying
    @Query(value = "update DOC_BINARY t set t.title = ?2,t.updateTime = ?3,t.content = ?4 where t.doc_id = ?1",nativeQuery = true)
    int updateByDocId(String docId,String title,String updateTime,byte[] bytes);
}
